{% load staticfiles %}
<div class="modal fade" id="peer_review_modal" role="dialog">
    <div class="modal-dialog" style="width:750px;">
        <div class="modal-content">
            <div class="modal-header">
                <a href="#" class="btn btn-success pull-right" data-dismiss="modal">×</a>
                <h4>Add Review</h4>
            </div>
            <div class="modal-body">
                <form>
                    <input type="hidden"
                             id="id_assignment_id"
                           name="assignment_id"
                          value={% if form.instance.assignment_id != None %}"{{ form.instance.assignment_id }}"{% else %}0{% endif %}>
                    {% if form.instance.question_type != None %}
                        <input type="hidden"
                                id="id_question_type"
                              name="question_type"
                             value="{{ form.instance.question_type }}">
                            {% endif %}
                            {% for field in form %}
                            <div class="row">
                                <div class="form-group">
                                    <div class="fieldWrapper">
                                        <label class="col-sm-3 control-label">
                                            {{ field.label }}
                                        </label>
                                        <div class="col-sm-9">
                                            {{ field }}
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <br/>
                    {% endfor %}
                </form>
                
                <!-- Error Message Box -->
                <div id="error_box" name="error_box" class="alert alert-danger alert-dismissable" hidden="true">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    ERROR: This is to be filled in by the "print_error" function. If you see this message that means there's an error with your javascript somewhere.
                </div><!-- /.Error Message Box -->
            </div>
            <div class="modal-footer">
                <button onclick="ajax_save_peer_review({{ question_id }}, {{ question_type }}, {{ submission_id }});"
                           type="button"
                          class="btn btn-primary">
                    <i class="fa fa-plus"></i> Submit
                </button>
            </div>
        </div>
    </div>
</div>


<script>
    $(document).ready(function(){
        // When this model hides, we will clear the contents of it.
        $('#peer_review_modal').on('hidden.bs.modal', function (e) {
            // Clear all the code inside this modal.
            $('#ajax_peer_review').html('');
        })
    });
</script>
